<template>
  <div class="pop-dialog-container">
    <div class="pop-dialog-main">
      <el-form label-position="right" :model="jobDescriptionForm" :label-width="formLabelWidth" disabled="disabled">
        <el-row>
          <el-col :span="11">
            <el-form-item label="企业名称">
              <el-input v-model="jobDescriptionForm.enterpriseName"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="岗位名称">
              <el-input v-model="jobDescriptionForm.jobTitle"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="11">
            <el-form-item label="部门名称">
              <el-input v-model="jobDescriptionForm.departmentName"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="工作地点">
              <el-input v-model="jobDescriptionForm.workLocation"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="11">
            <el-form-item label="岗位类型">
              <el-select v-model="jobDescriptionForm.jobType" placeholder="请选择岗位类型">
                <el-option label="全职" :value="10"></el-option>
                <el-option label="兼职" :value="20"></el-option>
                <el-option label="实习" :value="30"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="薪资范围">
              <el-select v-model="jobDescriptionForm.salaryRange" placeholder="请选择薪资范围">
                <el-option label="3000~5000" :value="1"></el-option>
                <el-option label="5001~10000" :value="2"></el-option>
                <el-option label="10001~20000" :value="3"></el-option>
                <el-option label="20001~30000" :value="4"></el-option>
                <el-option label="30000以上" :value="5"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="11">
            <el-form-item label="发布日期">
              <el-input v-model="jobDescriptionForm.postingDate"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="截止日期">
              <el-input v-model="jobDescriptionForm.closingDate"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="11">
            <el-form-item label="招聘人数">
              <el-input v-model="jobDescriptionForm.headCount"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="状态">
              <el-select v-model="jobDescriptionForm.status" placeholder="请选择状态">
                <el-option label="开放" :value="10"></el-option>
                <el-option label="关闭" :value="20"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="22">
            <el-form-item label="岗位职责" prop="responsibilities">
              <el-input type="textarea" :rows="3" v-model="jobDescriptionForm.responsibilities"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="22">
            <el-form-item label="岗位要求" prop="requirement">
              <el-input type="textarea" :rows="3" v-model="jobDescriptionForm.requirement"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="11">
            <el-form-item label="创建时间">
              <el-input v-model="jobDescriptionForm.createTime"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="最后修改时间">
              <el-input v-model="jobDescriptionForm.modifyTime"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="pop-dialog-footer">
      <el-row>
        <el-col :span="12" :offset="6">
          <div class="form-button-container">
            <el-button @click="onBack" type="primary">关闭</el-button>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import jobDescriptionApi from '@/api/jobDescriptionApi'
export default {
  name: 'JobDescriptionView',
  props: ['id'],
  mixins: [
  ],
  data () {
    return {
      jobDescriptionForm: {
      }
    }
  },
  created () {
    if (this.id) {
      jobDescriptionApi.findById(this.id)
          .then(resp => {
            if (resp && resp.code === 1) {
              this.jobDescriptionForm = resp.data
            } else {
              this.$message.error('获取数据失败')
            }
          })
          .catch(error => {
            console.error('获取数据失败:', error)
          })
    }
  },
  methods: {
    onBack () {
      this.$emit('close-job-description-view-event')
    }
  }
}
</script>

<style lang="scss">
</style>